$OpenBSD: patch-prnt_cups_py,v 1.8 2015/07/16 04:55:46 ajacoutot Exp $
--- prnt/cups.py.orig	Mon Jul 13 09:49:01 2015
+++ prnt/cups.py	Thu Jul 16 06:48:04 2015
@@ -175,8 +175,8 @@ ppd_pat = re.compile(r'''.*hp-(.*?)(-.*)*\.ppd.*''', r
 
 def getPPDPath(addtional_paths=None):
     """
-        Returns the CUPS ppd path (not the foomatic one under /usr/share/ppd).
-        Usually this is /usr/share/cups/model.
+        Returns the CUPS ppd path (not the foomatic one under ${LOCALBASE}/share/ppd).
+        Usually this is ${LOCALBASE}/share/cups/model.
     """
     if addtional_paths is None:
         addtional_paths = []
@@ -191,16 +191,16 @@ def getPPDPath(addtional_paths=None):
 
 def getAllowableMIMETypes():
     """
-        Scan all /etc/cups/*.convs and /usr/share/cups/mime
+        Scan all ${SYSCONFDIR}/cups/*.convs and ${LOCALBASE}/share/cups/mime
         files for allowable file formats.
     """
     paths = []
     allowable_mime_types = []
     files = []
-    if os.path.exists("/etc/cups"):
-        paths.append("/etc/cups/*.convs")
-    if os.path.exists("/usr/share/cups/mime"):
-        paths.append("/usr/share/cups/mime/*.convs")
+    if os.path.exists("${SYSCONFDIR}/cups"):
+        paths.append("${SYSCONFDIR}/cups/*.convs")
+    if os.path.exists("${LOCALBASE}/share/cups/mime"):
+        paths.append("${LOCALBASE}/share/cups/mime/*.convs")
     for path in paths:
         files.extend(glob.glob(path))
     for f in files:
@@ -261,11 +261,11 @@ def getSystemPPDs():
     else: # 1.2.x
         log.debug("(CUPS 1.2.x) Getting list of PPDs using CUPS_GET_PPDS...")
         ppd_dict = cupsext.getPPDList()
-        cups_ppd_path = getPPDPath() # usually /usr/share/cups/model
-        foomatic_ppd_path = sys_conf.get('dirs', 'ppdbase', '/usr/share/ppd')
+        cups_ppd_path = getPPDPath() # usually ${LOCALBASE}/share/cups/model
+        foomatic_ppd_path = sys_conf.get('dirs', 'ppdbase', '${LOCALBASE}/share/ppd')
 
         if not foomatic_ppd_path or not os.path.exists(foomatic_ppd_path):
-            foomatic_ppd_path = '/usr/share/ppd'
+            foomatic_ppd_path = '${LOCALBASE}/share/foomatic/db/source/PPD'
 
         log.debug("CUPS PPD base path = %s" % cups_ppd_path)
         log.debug("Foomatic PPD base path = %s" % foomatic_ppd_path)
@@ -284,8 +284,8 @@ def getSystemPPDs():
                         'gutenprint' in ppd):
 
                     # PPD files returned by CUPS_GET_PPDS (and by lpinfo -m)
-                    # can be relative to /usr/share/ppd/ or to
-                    # /usr/share/cups/model/. Not sure why this is.
+                    # can be relative to ${LOCALBASE}/share/ppd/ or to
+                    # ${LOCALBASE}/share/cups/model/. Not sure why this is.
                     # Here we will try both and see which one it is...
 
                     if os.path.exists(ppd):
@@ -343,7 +343,7 @@ number_pat = re.compile(r""".*?(\d+)""", re.IGNORECASE
 STRIP_STRINGS2 = ['foomatic:', 'hp-', 'hp_', 'hp ', '.gz', '.ppd',
                   'drv:', '-pcl', '-pcl3', '-jetready',
                  '-zxs', '-zjs', '-ps', '-postscript',
-                 '-jr', '-lidl', '-lidil', '-ldl', '-hpijs']
+                 '-jr', '-lidl', '-lidil', '-hpijs']
 
 
 for p in list(models.TECH_CLASS_PDLS.values()):
@@ -604,7 +604,7 @@ def getFaxPPDFile(mq, model):
 
 
 def getErrorLogLevel():
-    cups_conf = '/etc/cups/cupsd.conf'
+    cups_conf = '${SYSCONFDIR}/cups/cupsd.conf'
     try:
         f = open(cups_conf, 'r')
     except OSError:
